import { SearchFormFieldDefinition, MainAttributeInfoInterface } from "@/views/common/ts/Interface";
import { selectColumnFormatter } from "@/views/common/ts/CommonFunction";

export const searchFormConfig: SearchFormFieldDefinition[] = [
  {
    queryAttributeName: 'fuzzyUserName',
    queryAttributeLabel: '用户姓名',
    queryEditType: 'text',
    queryAttributePlaceholder: '模糊匹配',
    rules: [
      {
        type: 'string',
        max: 50,
        message: '用户姓名长度不能超过50个字符。'
      }
    ]
  },
  {
    queryAttributeName: 'userNumber',
    queryAttributeLabel: '用户数字号',
    queryEditType: 'number',
    queryAttributePlaceholder: '只能输入数值,精确匹配。'
  },
  {
    queryAttributeName: 'fuzzyDepartmentName',
    queryAttributeLabel: '用户部门名称',
    queryEditType: 'text',
    queryAttributePlaceholder: '模糊匹配',
    rules: [
      {
        type: 'string',
        max: 255,
        message: '用户部门名称长度不能超过255个字符。'
      }
    ]
  },
  {
    queryAttributeName: 'fuzzyUserMail',
    queryAttributeLabel: '用户邮箱',
    queryEditType: 'text',
    queryAttributePlaceholder: '模糊匹配',
    rules: [
      {
        type: 'string',
        max: 30,
        message: '用户邮箱长度不能超过30个字符。'
      }
    ]
  },
  {
    queryAttributeName: 'userSexSet',
    queryAttributeLabel: '用户性别',
    queryEditType: 'select',
    selectOperation: {
      options: [
        {
          value: 'F',
          label: '女'
        },
        {
          value: 'M',
          label: '男'
        }
      ],
    }
  },
  {
    queryAttributeName: 'userBirthday',
    queryAttributeLabel: '用户出生日期',
    queryEditType: 'datetime-range'
  },
  {
    queryAttributeName: 'fuzzyUserComments',
    queryAttributeLabel: '用户备注',
    queryEditType: 'text',
    queryAttributePlaceholder: '模糊匹配',
    rules: [
      {
        type: 'string',
        max: 500,
        message: '用户备注长度不能超过500个字符。'
      }
    ]
  },
  {
    queryAttributeName: 'createTime',
    queryAttributeLabel: '创建时间',
    queryEditType: 'datetime-range'
  },
  {
    queryAttributeName: 'updateTime',
    queryAttributeLabel: '修改时间',
    queryEditType: 'datetime-range'
  }
];


export const tableColumnList: MainAttributeInfoInterface[] = [
  {
    attributeName: 'userInfoId',
    attributeLabel: '用户信息ID',
    editType: 'text',
    unInsertable: true,
    unUpdatable: true,
    isDefaultHidden: true,
    extendsAttributeInfo: {}
  },
  {
    attributeName: 'userName',
    attributeLabel: '用户姓名',
    editType: 'text',
    rules: [
      {
        required: true,
        message: '用户姓名不能为空。'
      },
      {
        type: 'string',
        max: 50,
        message: '用户姓名长度不能超过50个字符。'
      }
    ],
    extendsAttributeInfo: {}
  },
  {
    attributeName: 'userNumber',
    attributeLabel: '用户数字号',
    editType: 'number',
    rules: [
      {
        required: true,
        message: '用户数字号不能为空。'
      }
    ],
    extendsAttributeInfo: {}
  },
  {
    attributeName: 'departmentName',
    attributeLabel: '用户部门名称',
    editType: 'text',
    addDefaultValue: 'DEFAULT',
    rules: [
      {
        required: true,
        message: '用户部门名称不能为空。'
      },
      {
        type: 'string',
        max: 255,
        message: '用户部门名称长度不能超过255个字符。'
      }
    ],
    extendsAttributeInfo: {}
  },
  {
    attributeName: 'userMail',
    attributeLabel: '用户邮箱',
    editType: 'text',
    rules: [
      {
        required: true,
        message: '用户邮箱不能为空。'
      },
      {
        type: 'string',
        max: 30,
        message: '用户邮箱长度不能超过30个字符。'
      }
    ],
    extendsAttributeInfo: {}
  },
  {
    attributeName: 'userSex',
    attributeLabel: '用户性别',
    editType: 'select',
    rules: [
      {
        required: true,
        message: '用户性别不能为空。'
      }
    ],
    selectOperation: {
      options: [
        {
          value: 'F',
          label: '女'
        },
        {
          value: 'M',
          label: '男'
        }
      ],
    },
    extendsAttributeInfo: {
      formatterFunction: selectColumnFormatter
    }
  },
  {
    attributeName: 'userBirthday',
    attributeLabel: '用户出生日期',
    editType: 'date',
    rules: [
      {
        required: true,
        message: '用户出生日期不能为空。'
      }
    ],
    extendsAttributeInfo: {}
  },
  {
    attributeName: 'userComments',
    attributeLabel: '用户备注',
    editType: 'text',
    rules: [
      {
        required: true,
        message: '用户备注不能为空。'
      },
      {
        type: 'string',
        max: 500,
        message: '用户备注长度不能超过500个字符。'
      }
    ],
    extendsAttributeInfo: {}
  },
  {
    attributeName: 'createTime',
    attributeLabel: '创建时间',
    editType: 'text',
    isSortable: true,
    unInsertable: true,
    unUpdatable: true,
    extendsAttributeInfo: {}
  },
  {
    attributeName: 'updateTime',
    attributeLabel: '修改时间',
    editType: 'text',
    isSortable: true,
    unInsertable: true,
    unUpdatable: true,
    extendsAttributeInfo: {}
  }
];
export const batchDeleteUri = '/web-display-server/userInfo/batchDeleteUserInfoList';
export const fetchListUri = '/web-display-server/userInfo/selectUserInfoList';
export const fetchDetailUri = '/web-display-server/userInfo/selectUserInfoList';
export const addUri = '/web-display-server/userInfo/saveUserInfo';
export const updateUri = '/web-display-server/userInfo/saveUserInfo';
export const BaseURI = '/web-display-server';
export const BaseExcelUri = BaseURI + '/webDisplayServerExcel';
export const primaryKey = 'userInfoId';
export const entityName = 'userInfo';
